package main

import (
	"demo/wechat/wechat"
)

const (
	corpId       = "ww1bf93efd6481f318"
	moyrnSecret  = "ugtG6WzBBVdv2ezaFTIr-61QQOB6_J2UbDtKW6Ks6HQ"
	moyrnAgentId = "1000007"
	infoSecret   = "_I1cxvF3NA_NirpsDAHnVaGn2PH2n6Q5cf-wvPPX33I"
	infoAgentId  = "1000005"
)

var markdown = `您的会议室已经预定，稍后会同步到` + "`邮箱`" + `
                >**事项详情**
                >事　项：<font color=\"info\">开会</font>
                >组织者：@miglioguan
                >参与者：@miglioguan、@kunliu、@jamdeezhou、@kanexiong、@kisonwang
                >
                >会议室：<font color=\"info\">广州TIT 1楼 301</font>
                >日　期：<font color=\"warning\">2018年5月18日</font>
                >时　间：<font color=\"comment\">上午9:00-11:00</font>
                >
                >请准时参加会议。
                >
                >如需修改会议信息，请点击：[修改会议信息](https://work.weixin.qq.com)
`

func main() {

	wechatClient := wechat.NewWechatClient(corpId, 10)
	if err := wechatClient.AddAgent(infoAgentId, infoSecret); err != nil {
		panic(err)
	}

	invalidUser, err := wechatClient.SendMarkdownMessage("moyrne", moyrnAgentId, markdown)
	if err != nil {
		panic(invalidUser + "\t" + err.Error())
	}
	if invalidUser != "" {
		panic(invalidUser)
	}

}
